#include "rsuctrlfactory.h"


BaseRsuCtrl *RsuCtrlFactory::getDev(int id, const QString &sDevType)
{
    QMap<int, BaseRsuCtrl *>::const_iterator it = m_DevMap.find(id);
    if (it!=m_DevMap.end())
    {
        BaseRsuCtrl *pDev = it.value();
        if (NULL!=pDev)
        {
            return pDev;
        }
    }

    BaseRsuCtrl *pDev = NULL;

    pDev=new RsuCtrl(id);

    pDev->configRsuType(sDevType);
    m_DevMap[id]=pDev;
    return pDev;
}

void RsuCtrlFactory::releaseDev(BaseRsuCtrl *pDev)
{
    int id = pDev->getId();
    delete pDev;
    m_DevMap.remove(id);
}

QMap<int, BaseRsuCtrl *> RsuCtrlFactory::m_DevMap;
